{extend name="common/main"}

{block name="css"}
<style>
    .lai{
        float: none;
        display:inline-block;
    }
</style>
{/block}

{block name="body"}
<body data-type="widgets">
{include file="common/index"}
<!-- 内容区域 -->
<div class="tpl-content-wrapper">
    <div class="row-content am-cf">
        <!--客户-->
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <!--<h3 class="widget-title  am-cf">用户信息</h3>-->
    <div class="widget am-cf">

        <div class="widget-head am-cf">
            <div class="widget-title  am-cf">用户信息</div>
        </div>
        <div class="widget-body am-fr">

            <form class="am-form tpl-form-border-form tpl-form-border-br "  form="submit" id="form">

                <div class="am-form-group">
                    <label for="user-weibo" class="am-u-sm-2">名称: </label>
                    <div class="am-u-sm-6 lai" >
                        <input type="text" name="nickname" id="user-weibo" value="{$res.nickname}">
                        <input type="hidden" name="mid" value="{$res.mid}">
                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-weibo" class="am-u-sm-2">登陆账号:</label>
                    <div class="am-u-sm-6 lai" >
                        <input type="text" name="phone" disabled="true" value="{$res.phone}">
                        <input type="hidden" name="id" value="{$res.id}">
                    </div>
                </div>

                <div class="am-form-group">
                    <label for="user-weibo" class="am-u-sm-2">类型: </label>
                    <div class="am-u-sm-6 lai" >
                        <input type="text" name="type" disabled="true" value="{if $res.type eq 0}用户{/if}">
                    </div>
                </div>

                <button type="button" class="am-btn am-btn-primary am-radius ad" onclick="roleSubmit()">确定</button>
                <a href="{:url('User/menu')}" data-toggle="tooltip" title="" class="am-btn am-btn-primary am-radius">返回</a>
            </form>
        </div>
    </div>
            </div>
        </div>

    </div>
</div>
</body>
{/block}
{block name="js"}
<script>
    //提交
    function roleSubmit() {
        var form = document.getElementById("form");
        var formData = new FormData(form);
        $.ajax({
            url: "{:Url('User/edit')}",
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false, //不设置内容类型
            processData: false, //不处理数据
            success: function (res) {
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 2});
                    return false;
                }
                layer.msg(res.msg, {shade: 0.5, time: 800, icon: 1}, function () {
                    window.location.href=document.referrer;//返回上一个界面刷新
                });
            }
        });
    }
</script>
{/block}